package dblayer;

import static org.junit.Assert.fail;
import modellayer.PartOrder;
import modellayer.Supplier;

import org.junit.Test;

public class SupplierDBTest {
	SupplierDB db = new SupplierDB();
	Supplier s;
	
	/*
	@Test
	public void InsertSupplierToDatabase() {
		int success = -1;
		try {
			s = new Supplier(33, "Kagemanden", "kagegade", "Danmark", "+45", "74185296", "kage@kage.dk");
			db.insertSupplier(s);
			success = 2;
		} catch (Exception e) {
			fail("Failed to insert supplier, Exception: " +e);
		}
		
		if (success ==-1){
			fail("Failed to insert supplier");
		}
	}
	
	*/
	
	@Test
	public void findSupplier()
	{
		Supplier su = db.findSupplier(3);
		
		if (su == null)
		{
			fail("Find PartOrder failed.");
		}
	}
	
		/*
	@Test
	public void deleteSupplier()
	{
		try
		{
			db.deleteSupplier(1);
		}
		catch(Exception e)
		{
			fail("Failed to delete object in the database. Exception: " +e);
		}
	}
	
	@Test
	public void updateSupplier()
	{
	int success = 1;
	int supplierId = 1;
	String name = "Hans Ikke Peter";
	String address = "IkkeSkubbergade";
	String country = "IkkeDanmark";
	String phonenumberOriginCode = "+44";
	String phonenumber = "98765432";
	String email = "IkkePik@pikIkke.com";
	
		try
		{
			db.updateSupplier(supplierId, name, address, country, phonenumberOriginCode, phonenumber, email);
		}
		catch (Exception e)
		{
			fail("Failed to find Supplier, Exception: " + e);
		}
		
		if (success==1) 
		{
			fail("Fail to find Supplier");
		}	
	}
	*/
}
